package com.qsw.paper.controller.user.advisor;


import com.qsw.paper.constant.MessageConstants;
import com.qsw.paper.pojo.dto.StudentsDto;
import com.qsw.paper.pojo.dto.StudentsQueryDto;
import com.qsw.paper.result.Result;
import com.qsw.paper.service.IStudentsService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * 前端控制器
 * </p>
 *
 * @author qsw
 * @since 2024-11-15
 */
@RestController("userAdvisorStudentsController")
@RequestMapping("/user/advisor/students")
@RequiredArgsConstructor
@Slf4j
public class StudentsController {

    private final IStudentsService studentsService;

    /**
     * 分页查询学生
     *
     * @param queryDto dto
     * @return 分页数据
     */
    @GetMapping("/list")
    public Result<?> pageList(StudentsQueryDto queryDto) {
        log.info("导师查询学生列表:{}", queryDto);
        return Result.success(studentsService.pageList(queryDto), MessageConstants.SELECT_OK);
    }


    /**
     * 获取学生详细信息
     *
     * @param id 学生id
     * @return 学生实体
     */
    @GetMapping("/{id}")
    public Result<?> findDetailById(@PathVariable Integer id) {
        log.info("导师获取学生详细信息：{}", id);
        return Result.success(studentsService.findById(id), MessageConstants.SELECT_OK);
    }


}
